import { TemplateRef } from '@angular/core';
import { FilterConfig } from '../core/api';

export interface SelectFilterConfig extends FilterConfig {
  customFilter?: <T>(data: T[], filter: FilterConfig) => T[];
  customItemFilter?: <T>(data: T, filter: FilterConfig) => boolean;
}

export interface OptionItem {
  [key: string]: any;
  key?: any;
  label: any;
  value?: any;
  isLeaf?: boolean;
  children?: OptionItem[];
  disabled?: boolean;
  disabledTips?: string | TemplateRef<any>;
  readonly?: boolean;
  hoverDisabled?: boolean;
}

export interface SelectNode extends OptionItem {
  parent?: SelectNode;
  children?: SelectNode[];
  // hidden?: boolean; // 是否隐藏节点，当隐藏选中项时可用
  hiddenMatch?: boolean; // 搜索时，判断是否节点匹配
  active?: boolean; // 当子项被选中，父项高亮标识
  selected?: boolean;
  originData: OptionItem;
}
